package cn.linjianhui.thread.future;

public class RealData implements Data {
    protected final String result;

    public RealData(String para) {
        // RealData的构造可能很慢，需要用户等待很久，这里用Sleep模拟
        StringBuilder sb = new StringBuilder();
        for(int i = 1; i <= 10; i++) {
            sb.append(i);
            try{
                Thread.sleep(100);
            }catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        result = sb.toString();
    }

    @Override
    public String getResult() {
        return result;
    }
}
